//
//  CZNetWork.h
//  JiaZhaengHuiYuan
//
//  Created by YYKJ1 on 2018/11/23.
//  Copyright © 2018年 YYKJ1. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface CZNetWork : NSObject

//typedef NS_ENUM(NSInteger, AFNetworkReachabilityStatus) {
//    AFNetworkReachabilityStatusUnknown          = -1, //未知
//    AFNetworkReachabilityStatusNotReachable     = 0,  //无连接
//    AFNetworkReachabilityStatusReachableViaWWAN = 1,  //3G
//    AFNetworkReachabilityStatusReachableViaWiFi = 2,  //WIFI
//};

/*
 *  下载进度
 *
 *  @param bytesDownload                 已下载的大小
 *  @param totalBytesDownload            文件总大小
 *  @param totalBytesExpectedToDownload  还有多少需要下载
 */
typedef void (^CZDownloadProgress)(int64_t bytesDownload,
                                   int64_t totalBytesDownload);

typedef CZDownloadProgress CZGetProgress;
typedef CZDownloadProgress CZPostProgress;

/*
 *  上传进度
 *
 *  @param bytesUpload              已上传的大小
 *  @param totalBytesUpload         总上传大小
 */
typedef void (^HYBUploadProgress)(int64_t bytesUpload,
                                  int64_t totalBytesUpload);



//请求成功回调block
typedef void (^CZResponseSuccessBlock)(id success);

//请求失败回调block
typedef void (^CZResponseFailureBlock)(NSError *error);

//发送数据block
typedef void (^CZRequestDataBlock)(id data);

+(void)post:(NSString *)url params:(id)params success:(CZResponseSuccessBlock)success failure:(CZResponseFailureBlock)failure;

+(void)get:(NSString *)url params:(id)params success:(CZResponseSuccessBlock)success failure:(CZResponseFailureBlock)failure;

//上传图片
+(void)loginAndRegisterWith:(NSString *)urlStr parameters:(id)paramesters dicy:(NSDictionary*)dicy requestData:(NSData *)data withName:(NSString *)name withFileName:(NSString *)fileName success:(CZResponseSuccessBlock)success fail:(CZResponseFailureBlock)fail;


+(void)postImage:(NSString *)urlStr parameters:(id)paramesters requestData:(NSData *)data withName:(NSString *)name withFileName:(NSString *)fileName success:(CZResponseSuccessBlock)success fail:(CZResponseFailureBlock)fail;


//FormData
+(void)loginAndRegisterWith:(NSString *)urlStr parameters:(id)paramesters  success:(CZResponseSuccessBlock)success fail:(CZResponseFailureBlock)fail;

//下载

+(void)downloadUrl:(NSString *)url
        progress:(CZPostProgress)progress
        success:(CZResponseSuccessBlock)success
           failure:(CZResponseFailureBlock)fail;



//网络监听
+(void)WangLuoJianTing:(id)view;
    

+(void)QuXiaoDanGe;
@end
